/**
 * 
 */
package niuke;

import java.util.ArrayList;
import java.util.Scanner;

public class WAP11 {
	static ArrayList<int[]> res = new ArrayList<>();

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();
		n = 4;
		k = 2;// ----------------------
		int[] a = new int[k];
		// System.out.println("1 " + res.size());

		getRes(n, k, 1, a, 0);

		// System.out.println("11 " + res.size());
		for (int[] s : res) {
			for (int m : s) {
				System.out.print(m + " ");
			}
			System.out.println();
		}
	}

	public static void getRes(int n, int k, int i, int[] a, int j) {
		if (j == k) {// 填满
			res.add(a);
			return;
		}
		if (i > n) {
			return;
		}
		int[] b = new int[k];
		for (int p = 0; p < j; p++) {
			b[p] = a[p];
		}
		a[j] = i;
		getRes(n, k, i + 1, a, j + 1);// 放入i

		getRes(n, k, i + 1, b, j);// 不放入i
	}
}
